const express = require('express');
const router = new express.Router();

router.get('/forCurrentUser', async(req, res, next) => {
    const options = {
        code: req.query.code,
        dealerId: req.query.dealerId,
        subDealerId: req.query.subDealerId,
        brandId: req.query.brandId,
        status: req.query.status,
        beginCreateTime: req.query.beginCreateTime,
        endCreateTime: req.query.endCreateTime,
        beginSubmitTime: req.query.beginSubmitTime,
        endSubmitTime: req.query.endSubmitTime,
        beginApproveTime: req.query.beginApproveTime,
        endApproveTime: req.query.endApproveTime,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id297',
                    code: 'string',
                    brandCode: 'string',
                    dealerCode: 'string',
                    dealerName: 'string',
                    subDealerCode: 'string',
                    subDealerName: 'string',
                    country: 'string',
                    productCategoryCode: 'string',
                    faultDescription: 'string',
                    mileage: 0,
                    consultType: 1,
                    status: 2,
                    createTime: '2020-05-18T07:49:32.411Z',
                    rowVersion: 'string',
                    options: ['update', 'abandon', 'submit', 'solved', 'close', 'transferToTechnicalCase', 'reply', 'reportAgain', 'feedback']
                },
                {
                    id: 'id304',
                    code: 'string',
                    brandCode: 'string',
                    dealerCode: 'string',
                    dealerName: 'string',
                    subDealerCode: 'string',
                    subDealerName: 'string',
                    country: 'string',
                    productCategoryCode: 'string',
                    faultDescription: 'string',
                    mileage: 0,
                    consultType: 2,
                    status: 1,
                    createTime: '2020-05-18T07:49:32.411Z',
                    rowVersion: 'string',
                    options: ['update', 'abandon', 'submit', 'solved', 'close', 'transferToTechnicalCase', 'reply', 'reportAgain', 'feedback']
                },
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */
router.post('/', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id
 * @throws {Error}
 * @return {Promise}
 */
router.get('/export', (req, res) => {
    res.json({
        message: '导出成功',
        payload: 'Mock导出'
    });
});
router.get('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message',
        payload: {
            id: 'id311',
            code: 'string',
            brandId: 'string',
            brandCode: 'string',
            dealerId: 'string',
            dealerCode: 'string',
            dealerName: 'string',
            subDealerId: 'string',
            subDealerCode: 'string',
            subDealerName: 'string',
            telPhone: 'string',
            email: 'string',
            createTime: '2020-05-19T01:02:33.274Z',
            creatorName: 'string',
            vin: 'string',
            engineCode: 'string',
            engineModel: 'string',
            transmissionSn: 'string',
            productionDate: '2020-05-19T01:02:33.274Z',
            saleDate: '2020-05-19T01:02:33.274Z',
            productCategoryCode: 'string',
            annoucementNumber: 'string',
            consultType: 0,
            faultDate: '2020-05-19T01:02:33.274Z',
            faultItemId: 'string',
            faultItemName: 'string',
            faultItemCode: 'string',
            mileage: 0,
            supplierId: 'string',
            supplierName: 'string',
            supplierCode: 'string',
            transmissionType: 0,
            faultDescription: 'string',
            measureEffects: 'string',
            suggestion: 'string',
            analysisResults: 'string',
            dealMethod: 'string',
            submitTime: '2020-05-19T01:02:33.274Z',
            handleTime: '2020-05-19T01:02:33.274Z',
            closeTime: '2020-05-19T01:02:33.274Z',
            isTransferTechnicalCase: true,
            rowVersion: 'string',
            options: ['update', 'abandon', 'submit', 'solved', 'close', 'transferToTechnicalCase', 'reply', 'reportAgain', 'feedback'],
            attachments: [
                {
                    fileId: 'fileId319',
                    fileName: 'fileName320'
                },
                {
                    fileId: 'fileId321',
                    fileName: 'fileName322'
                }
            ],
            details: [
                {
                    id: '1',
                    no: 'string',
                    replyDate: 'string',
                    source: 'string',
                    replyName: 'string',
                    replyComments: 'string',
                    attachments: [
                        {
                            fileId: 'fileId319',
                            fileName: 'fileName320'
                        },
                        {
                            fileId: 'fileId321',
                            fileName: 'fileName322'
                        }
                    ],
                },
                {
                    id: '2',
                    no: 'string',
                    replyDate: 'string',
                    source: 'string',
                    replyName: 'string',
                    replyComments: 'string',
                    attachments: [
                        {
                            fileId: 'fileId319',
                            fileName: 'fileName320'
                        },
                        {
                            fileId: 'fileId321',
                            fileName: 'fileName322'
                        }
                    ],
                }
            ]
        }
    };
    res.json(data);
});

/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/submit', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.put('/:id/abandon', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.put('/:id/solved', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.put('/:id/close', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.put('/:id/transferToTechnicalCase', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.put('/:id/reply', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.put('/:id/reportAgain', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.put('/:id/feedback', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});

module.exports = router;
